<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Map类型管理dom节点</title>
</head>
<body>
    <div name="后盾人">xiasnn</div>
    <div name="hdr">xiaxia</div>
    <script>
        let divs = document.querySelectorAll('div');
        let map = new Map();
        divs.forEach(item => {
            map.set(item,{content : item.getAttribute("name")});
        });
        // console.log(map);

        map.forEach((value,key) => {
            key.addEventListener("click",function() {
                alert(this.innerHTML);
            })

            console.log(value);
            console.log(key);
        })
    </script>
</body>
</html>